﻿using BussinessObject.ObjectTwo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ProjectHK3.App_Code;
namespace ProjectHK3.Object_One
{
    public partial class City : System.Web.UI.Page
    {
        B_LoadGidAD ex = new B_LoadGidAD();
        B_AdminDetail fx = new B_AdminDetail();
        B_Delete sx = new B_Delete();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                load();

            }
        }
        public void load()
        {
            Label5.Text = fx.getCity().ToString();
            GridView1.DataSource = ex.loadCity();
            GridView1.DataBind();
        }
        protected void _lbtDelete_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
               
           //   Session["companyId"] = Convert.ToInt32(e.CommandArgument.ToString());
                if (sx.DeleteCity(Convert.ToInt32(e.CommandArgument.ToString())) == true)
                {
                    load();
                    Alert.Show("Delete Successful!!!");
                }
                else
                {
                    Alert.Show("Delete fail!!!");
                }
            } 
            
        }

        protected void _lbtViewDetails_Command(object sender, CommandEventArgs e)
        {
            Session["city"] = Convert.ToInt32(e.CommandArgument.ToString());
            Response.Redirect("../Object One/CityDetail.aspx");
        }
        protected void _lbtViewBranch_Command(object sender, CommandEventArgs e)
        {
            Session["Bran"] = Convert.ToInt32(e.CommandArgument.ToString());
            Response.Redirect("../Object One/BranchDetail.aspx");
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {

        }
    }
}